namespace ProduceBasicData.Api.DTO
{
    /// <summary>
    /// 工单实时进度DTO类
    /// </summary>
    public class WorkOrderProgressDto
    {
        /// <summary>
        /// 序号
        /// </summary>
        public int SerialNumber { get; set; }

        /// <summary>
        /// 工单ID
        /// </summary>
        public int WorkOrderId { get; set; }

        /// <summary>
        /// 工单号
        /// </summary>
        public string OrderNo { get; set; } = string.Empty;

        /// <summary>
        /// 工单类型
        /// </summary>
        public string WorkType { get; set; } = string.Empty;

        /// <summary>
        /// 状态（1初始化,2待审批,3已开工,4已完成）
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 状态名称
        /// </summary>
        public string StatusName { get; set; } = string.Empty;

        /// <summary>
        /// 状态进度百分比（基于状态的固定进度）
        /// </summary>
        public int StatusProgress { get; set; }

        /// <summary>
        /// 状态颜色
        /// </summary>
        public string StatusColor { get; set; } = string.Empty;

        /// <summary>
        /// 进度百分比（0-100）
        /// </summary>
        public decimal ProgressPercentage { get; set; }

        /// <summary>
        /// 总数量
        /// </summary>
        public int TotalQuantity { get; set; }

        /// <summary>
        /// 已完成数量
        /// </summary>
        public int CompletedQuantity { get; set; }

        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 计划结束时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际结束时间
        /// </summary>
        public DateTime? ActualEndTime { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string ProductName { get; set; } = string.Empty;

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; } = string.Empty;
    }

    /// <summary>
    /// 工单实时进度图表数据DTO类
    /// </summary>
    public class WorkOrderProgressChartDto
    {
        /// <summary>
        /// 工单进度数据列表
        /// </summary>
        public List<WorkOrderProgressDto> WorkOrders { get; set; } = new List<WorkOrderProgressDto>();

        /// <summary>
        /// 统计信息
        /// </summary>
        public WorkOrderProgressStatistics Statistics { get; set; } = new WorkOrderProgressStatistics();

        /// <summary>
        /// 图表数据（用于ECharts）
        /// </summary>
        public WorkOrderProgressChartData ChartData { get; set; } = new WorkOrderProgressChartData();
    }

    /// <summary>
    /// 工单进度统计信息
    /// </summary>
    public class WorkOrderProgressStatistics
    {
        /// <summary>
        /// 总工单数
        /// </summary>
        public int TotalWorkOrders { get; set; }

        /// <summary>
        /// 已完成工单数
        /// </summary>
        public int CompletedWorkOrders { get; set; }

        /// <summary>
        /// 进行中工单数
        /// </summary>
        public int InProgressWorkOrders { get; set; }

        /// <summary>
        /// 待审批工单数
        /// </summary>
        public int PendingWorkOrders { get; set; }

        /// <summary>
        /// 总生产数量
        /// </summary>
        public int TotalProductionQuantity { get; set; }

        /// <summary>
        /// 已完成数量
        /// </summary>
        public int CompletedProductionQuantity { get; set; }

        /// <summary>
        /// 整体完成率
        /// </summary>
        public decimal OverallCompletionRate { get; set; }
    }

    /// <summary>
    /// 工单进度图表数据
    /// </summary>
    public class WorkOrderProgressChartData
    {
        /// <summary>
        /// 工单号列表（用于X轴）
        /// </summary>
        public List<string> OrderNumbers { get; set; } = new List<string>();

        /// <summary>
        /// 进度百分比列表（用于Y轴）
        /// </summary>
        public List<decimal> ProgressPercentages { get; set; } = new List<decimal>();

        /// <summary>
        /// 状态列表（用于颜色区分）
        /// </summary>
        public List<string> StatusNames { get; set; } = new List<string>();

        /// <summary>
        /// 状态颜色列表
        /// </summary>
        public List<string> StatusColors { get; set; } = new List<string>();
    }
}
